{include file="public/header" /}
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>待发货订单</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get">
        <div class="ds-search-form">
            <dl>
                <dt>{$Think.lang.ds_order_sn}</dt>
                <dd><input type="text" class="text w150" name="order_sn" value="{$Request.param.order_sn}"></dd>
                <dt>{$Think.lang.ds_buyer_name}</dt>
                <dd>
                    <input type="text" class="text w80" name="buyer_name" value="{$Request.param.buyer_name}">
                </dd>
            </dl>
            <dl>
                <dt>{$Think.lang.order_state}</dt>
                <dd>
                    <select name="order_state" class="querySelect">
                        <option value="">{$Think.lang.ds_please_choose}</option>
                        <option value="0" {if condition="$Request.param.order_state eq '0'"}selected{/if}>待付款</option>
                        <option value="10" {if condition="$Request.param.order_state eq '10'"}selected{/if}>待收货</option>
                        <option value="20" {if condition="$Request.param.order_state eq '20'"}selected{/if}>已完成</option>
                        <option value="30" {if condition="$Request.param.order_state eq '30'"}selected{/if}>已取消</option>
                        <option value="40" {if condition="$Request.param.order_state eq '40'"}selected{/if}>待退款</option>
                    </select>
                </dd>
                <dt>项目名称</dt>
                <dd><input type="text" class="text w150" name="project_name" value="{$Request.param.project_name}"></dd>
            </dl>
            <dl>
                <dt>{$Think.lang.order_time_from}</dt>
                <dd>
                    <input type="text" class="txt date" name="query_start_time" id="query_start_time" value="{$Request.param.query_start_time}">
                    &nbsp;–&nbsp;
                    <input id="query_end_time" class="txt date" type="text" name="query_end_time" value="{$Request.param.query_end_time}">
                </dd>
            </dl>
            <div class="btn_group">
                <input type="submit" class="btn" value="{$Think.lang.ds_search}" style="display: inline-block;">
                {if $filtered}
                <a href="{:url('projectorder/index')}" class="btn btn-default" title="{$Think.lang.ds_cancel}">{$Think.lang.ds_cancel}</a>
                {/if}
            </div>
        </div>    
    </form>

    <table class="ds-default-table">
        <thead>
            <tr>
                <th>订单编号</th>
                <th>买家账号</th>
                <th>下单时间</th>
                <th>项目名称</th>
                <th>订单总价</th>
                <th>订单状态</th>
                <th>操作</th>
            </tr>
        </thead>
        {empty  name="order_list"}
        <tbody>
            <tr class="no_data">
                <td colspan="20">{$Think.lang.no_record}</td>
            </tr>
        </tbody>
        {else /}
        <tbody>
            {foreach name="order_list" item="order"}
            <tr>
                <td>{$order.order_sn}</td>
                <td>{$order.buyer_name}</td>
                <td>{$order.add_time|date='Y-m-d H:i:s',###}</td>
                <td>{$order.project_name}</td>
                <td>{$order.order_amount}</td>
                <td>{$order_status[$order['order_state']]}</td>
                <td>
                    <a href="{:url('projectorder/projectorder_list',['order_id'=>$order.order_id])}" class="dsui-btn-view"><i class="iconfont"></i>查看</a>

                    {if condition="$order.order_state gt '10' "}
                        {if condition="$order.goodsbill eq '0' "}
                        <a href="{:url('projectorder/project_goods',['project_id'=>$order.project_id,'order_id'=>$order.order_id])}" class="dsui-btn-edit"><i class="iconfont"></i>商品管理</a>
                        
                        {/if}
                    {/if}

                    <?php if($order['order_state']==20 || $order['order_state'] == 30){ ?>
                        <!-- <a href="{:url('projectorder/generate_service_single',['order_id'=>$order.order_id,'project_id'=>$order.project_id])}" class="dsui-btn-edit"><i class="iconfont"></i>生成服务单</a> -->
                    <?php }?>

                    <?php if($order['order_state']!=50 && $order['order_state']!=10){ ?>
                    <a href="javascript:dsLayerConfirm('{:url('projectorder/refund_order',['order_id'=>$order.order_id])}','您确定要退款该订单吗？')" class="dsui-btn-edit"><i class="iconfont"></i>退款</a>
                    <?php }?>

                    <?php if($order['order_state']!=2&&$order['is_cancel']!=1){ ?>
                    <a href="javascript:dsLayerConfirm('{:url('projectorder/del_order',['order_id'=>$order.order_id])}','您确定要作废该订单吗？')" class="dsui-btn-del"><i class="iconfont"></i>作废订单</a>
                    <?php }?>
                    
                </td>
            </tr>
            {/foreach}
        </tbody>
        {/empty}
    </table>
    {$show_page}
</div>

<script type="text/javascript">
$(function(){
    $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
    $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});
});
</script> 

